package spitfire.ksim.data;

import java.util.ArrayList;
import java.util.List;

import spitfire.ksim.algorithm.FuzzyRule;

public class TSDUpdateData {
	
	public class UpdateEntry {
		public String sensorType;
		public String sensorSD;
		public FuzzyRule rule;
		
		public UpdateEntry(String sensorType, String sensorSD, FuzzyRule rule) {
			this.sensorType = sensorType;
			this.sensorSD = sensorSD;
			this.rule = rule;
		}
		
		@Override
		public String toString() {
			StringBuilder builder = new StringBuilder();
			builder.append("[");
			builder.append(sensorType);
			builder.append(", ");
			builder.append(sensorSD);
			builder.append(", ");
			builder.append(rule);
			builder.append("]");
			return builder.toString();
		}
	}
	
	private String nodeId;
	private List<UpdateEntry> entrytList = new ArrayList<UpdateEntry>();

	public TSDUpdateData(String nodeId) {
		this.nodeId = nodeId;
	}
	
	public void addSensorSnapshot(String sensorType, String sensorSd, FuzzyRule rule) {
		entrytList.add(new UpdateEntry(sensorType, sensorSd, rule));
	}
	
	public List<UpdateEntry> getData() {
		return entrytList;
	}
	
	public String getNodeId() {
		return nodeId;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("TSDUpdateData [nodeId=");
		builder.append(nodeId);
		builder.append(", data=");
		builder.append(entrytList);
		builder.append("]");
		return builder.toString();
	}
}
